class_name PlayerHurtState
extends GameplayState

@onready var player: Player = $"../../"


func _on_enter() -> void:
    player.play_animation("hurt")

    player.add_tag(GameplayTagLibrary.State_Hurt)

    player.velocity = Vector2(100.0 * -player.face_direction, -100)

    get_tree().create_timer(0.2).timeout.connect(func(): change_state("GhostState", func(): pass))

    player.animator.material.set_shader_parameter("active", true)


func _on_exit() -> void:
    player.remove_tag(GameplayTagLibrary.State_Hurt)

    player.animator.material.set_shader_parameter("active", false)
